﻿// -----------------------------------------------------------------------
// <copyright file="IPushService.cs" company="Zen Design Corp">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Zen.BlackBerry.Push
{
	using System.Threading.Tasks;

	/// <summary>
	/// Interface for sending push messages, cancelling a previously submitted
	/// message or querying the status of a previously submitted message.
	/// </summary>
	/// <remarks>
	/// Note that, for PushService and related parameters and results classes,
	/// an "address" is a subscriber id (i.e. Subscriber.getId()).
	/// The only exception to this is when pushing to a push application with:
	///		• a type of PushApplicationType.ENTERPRISE_PUSH
	///		• a bypass subscription flag set to true (PushApplication.isBypassSubscription() == true)
	///	
	/// in which case an address is the client address (i.e. PIN or email address).
	/// </remarks>
	public interface IPushService
	{
		/// <summary>
		/// Sends a cancel request using the attributes specified.
		/// </summary>
		/// <param name="applicationId">The application id.</param>
		/// <param name="pushId">The push id.</param>
		/// <returns></returns>
		Task<CancelResult> Cancel(string applicationId, string pushId);

		/// <summary>
		/// Sends a cancel request using the attributes specified.
		/// </summary>
		/// <param name="applicationId">The application id.</param>
		/// <param name="pushId">The push id.</param>
		/// <param name="addresses">The addresses.</param>
		/// <returns></returns>
		Task<CancelResult> Cancel(string applicationId, string pushId, params string[] addresses);

		/// <summary>
		/// Sends a push request using the attributes specified.
		/// </summary>
		/// <param name="pushParameters">The push parameters.</param>
		/// <returns></returns>
		Task<PushResult> Push(PushParameters pushParameters);

		/// <summary>
		/// Sends a status query using the attributes specified.
		/// </summary>
		/// <param name="applicationId">The application id.</param>
		/// <param name="pushId">The push id.</param>
		/// <returns></returns>
		Task<StatusResult> StatusQueryAll(string applicationId, string pushId);

		/// <summary>
		/// Sends a status query using the attributes specified.
		/// </summary>
		/// <param name="applicationId">The application id.</param>
		/// <param name="pushId">The push id.</param>
		/// <param name="addresses">The addresses.</param>
		/// <returns></returns>
		Task<StatusResult> StatusQueryAll(string applicationId, string pushId, params string[] addresses);

		/// <summary>
		/// Sends a status query using the attributes specified.
		/// </summary>
		/// <param name="applicationId">The application id.</param>
		/// <param name="pushId">The push id.</param>
		/// <returns></returns>
		Task<StatusResult> StatusQueryCompleted(string applicationId, string pushId);

		/// <summary>
		/// Sends a status query using the attributes specified.
		/// </summary>
		/// <param name="applicationId">The application id.</param>
		/// <param name="pushId">The push id.</param>
		/// <returns></returns>
		Task<StatusResult> StatusQueryFailed(string applicationId, string pushId);

		/// <summary>
		/// Sends a status query using the attributes specified.
		/// </summary>
		/// <param name="applicationId">The application id.</param>
		/// <param name="pushId">The push id.</param>
		/// <returns></returns>
		Task<StatusResult> StatusQueryPending(string applicationId, string pushId);
	}
}
